Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

es6-template

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es6-template

Easy and small template engine for the browser and nodejs.

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6.4K
increased by16.51%
Maintainers
1
Weekly downloads
 
Created
Source

es6-template npmjs.com The MIT License

Easy and small template engine for the browser and nodejs.

code climate standard code style travis build status coverage status dependency status

Install

npm i es6-template --save

Usage

For more use-cases see the tests

var es6template = require('es6-template')

es6template

Acts like .render by default. Renders given str with locals.

  • str {String} template to populate with locals
  • locals {Object} locals object
  • return {String} rendered string

Example

es6template('foo ${bar} baz ${quux}', {bar: 'BAR'}, {quux: 'QUUX'})
//=> 'foo BAR baz QUUX'

.render

Renders given str with locals. You can give unlimited number of object arguments after the first - they will be merged and passed as single locals object.

  • str {String} template to populate with locals
  • locals {Object} locals object
  • return {String} rendered string

Example

es6template.render('Hello ${place} and ${user.name}!', {
  place: 'world',
  user: {
    name: 'Charlike'
  }
})
//=> 'Hello world and Charlike!'

.compile

Compiles given string and returns function which accepts unlimited number of locals object arguments.

  • str {String} template to populate
  • return {Function} which accepts locals objects

Example

var fn = es6template.compile('Hello ${place} and ${user.name}!')
fn({place: 'world', user: {name: 'Charlike'}})
//=> 'Hello world and Charlike!'

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.

Charlike Make Reagent new message to charlike freenode #charlike

tunnckocore.tk keybase tunnckocore tunnckoCore npm tunnckoCore twitter tunnckoCore github

Keywords

FAQs

Package last updated on 13 Jan 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc